package src
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.display.MovieClip;
	import gs.TweenMax;

	public class MenuPricipal extends Sprite
	{
		private var i:int;
		
		public function MenuPricipal()
		{
			var _clip;
			for(i=0; i < this.numChildren; i++){
				_clip = this.getChildAt(i);
				desactiva(_clip);
			}
		}
		
		private function clic (e:MouseEvent):void
		{
			var _clip;
			for(i=0; i < this.numChildren; i++){
				_clip = this.getChildAt(i);
				desactiva(_clip);
			}
			activa(e.currentTarget);
			MovieClip(root).seccion(e.currentTarget.name);
		}
		
		private function desactiva (_clip:Object):void
		{			
			_clip.elegido.visible = false;
			TweenMax.to(_clip.texto_mc, 0.05, {tint:0});
			_clip.elegido.alpha = 0;
			_clip.buttonMode = true;
			_clip.mouseChildren = false;
			_clip.addEventListener(MouseEvent.CLICK, clic);
			
		}
		
		private function activa (_clip:Object):void
		{	
			_clip.elegido.visible = true;		
			TweenMax.to(_clip.elegido, 0.3, {alpha:1});
			TweenMax.to(_clip.texto_mc, 0.3, {tint:0xFFFFFF});
			_clip.buttonMode = false;
			_clip.mouseChildren = false;
			_clip.removeEventListener(MouseEvent.CLICK, clic);
			
		}
		
		
	}
}